package cn.iocoder.yudao.module.project.dal.mysql.kismaterielexwarehouse;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.kismaterielexwarehouse.KisMaterielExWarehouseDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.kismaterielexwarehouse.vo.*;

/**
 * 物料出库单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface KisMaterielExWarehouseMapper extends BaseMapperX<KisMaterielExWarehouseDO> {

    default PageResult<KisMaterielExWarehouseDO> selectPage(KisMaterielExWarehousePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KisMaterielExWarehouseDO>()
                .eqIfPresent(KisMaterielExWarehouseDO::getExCode, reqVO.getExCode())
                .eqIfPresent(KisMaterielExWarehouseDO::getOrderCode, reqVO.getOrderCode())
                .eqIfPresent(KisMaterielExWarehouseDO::getType, reqVO.getType())
                .eqIfPresent(KisMaterielExWarehouseDO::getCode, reqVO.getCode())
                .eqIfPresent(KisMaterielExWarehouseDO::getSpecification, reqVO.getSpecification())
                .eqIfPresent(KisMaterielExWarehouseDO::getCartonCode, reqVO.getCartonCode())
                .betweenIfPresent(KisMaterielExWarehouseDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(KisMaterielExWarehouseDO::getMaterialStatus, reqVO.getMaterialStatus())
                .eqIfPresent(KisMaterielExWarehouseDO::getRacketModel, reqVO.getRacketModel())
                .eqIfPresent(KisMaterielExWarehouseDO::getSheetNum, reqVO.getSheetNum())
                .eqIfPresent(KisMaterielExWarehouseDO::getWeight, reqVO.getWeight())
                .eqIfPresent(KisMaterielExWarehouseDO::getCutSize, reqVO.getCutSize())
                .eqIfPresent(KisMaterielExWarehouseDO::getKnivesNum, reqVO.getKnivesNum())
                .eqIfPresent(KisMaterielExWarehouseDO::getAmount, reqVO.getAmount())
                .eqIfPresent(KisMaterielExWarehouseDO::getMaterialsCut, reqVO.getMaterialsCut())
                .eqIfPresent(KisMaterielExWarehouseDO::getAddLayers, reqVO.getAddLayers())
                .eqIfPresent(KisMaterielExWarehouseDO::getMaterialCheck, reqVO.getMaterialCheck())
                .eqIfPresent(KisMaterielExWarehouseDO::getIssuMaterials, reqVO.getIssuMaterials())
                .eqIfPresent(KisMaterielExWarehouseDO::getRemark, reqVO.getRemark())
                .orderByDesc(KisMaterielExWarehouseDO::getId));
    }




    List<KisMaterielExWarehouseDO> selectSavedList(Map<String, Object> params);

    void insertList(List<KisMaterielExWarehouseDO> insertList);

    void updateList(List<KisMaterielExWarehouseDO> updateList);

    List<KisMaterielExWarehouseDO> selectMaterialByCartonCodes(Map<String, Object> params);

    Long countMaterialExWarehouseList(Map<String, Object> params);

    List<KisMaterialExWarehouseListVO> selectMaterialExWarehouseList(Map<String, Object> params);

    default PageResult<KisMaterielExWarehouseDO> detailByExCode(KisMaterielExWarehousePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KisMaterielExWarehouseDO>()
                .eqIfPresent(KisMaterielExWarehouseDO::getExCode, reqVO.getExCode())
                .eqIfPresent(KisMaterielExWarehouseDO::getSubmitStatus, reqVO.getSubmitStatus())
                .orderByDesc(KisMaterielExWarehouseDO::getId));
    }

    Integer selectUncheckMaterialByOrderCode(Map<String, Object> params);
    List<KisMaterielExWarehouseDO> selectSingleCartonByOrderCodeAndType(Map<String, Object> params);
    List<KisMaterielExWarehouseDO> selectTypeByOrderCode(Map<String, Object> params);
    List<KisMaterielExWarehouseDO> selectLastExCodeByOrderCode(Map<String, Object> params);
    List<KisMaterialExWarehouseListVO> selectExCodeByOrderCode(Map<String, Object> params);
    Long countExCodeByOrderCode(Map<String, Object> params);

    List<String> getExCodeByOrderCode(Map<String, Object> params);
}